import request from '@/utils/request'

// 查询出库记录列表
export function listStockOut(query) {
  return request({
    url: '/store/stockOut/list',
    method: 'get',
    params: query
  })
}

// 查询出库记录列表
export function listForReciveOrder(query) {
  return request({
    url: '/store/stockOut/listForReciveOrder',
    method: 'get',
    params: query
  })
}

//获取所有销售订单
export function getList() {
  return request({
    url: '/xiaoshou/order/getList',
    method: 'get',
  })
}
export function saleOrderList(orderId) {
  return request({
    url: '/xiaoshou/saleOrderDetail/'+orderId,
    method: 'get',
  })
}
export function getOrder(Id) {
  return request({
    url: '/xiaoshou/order/' + Id,
    method: 'get'
  })
}


// 查询出库记录详细
export function getStockOut(id) {
  return request({
    url: '/store/stockOut/' + id,
    method: 'get'
  })
}

export function getOutType() {
  return request({
    url: '/store/stockType/getOutType',
    method: 'get'
  })
}
export function getBuyBackOrderList() { 
  return request({
    url: '/caigou/buyBackOrder/listAll',
    method: 'get'
  })
}
export function getBuyBackOrderDetail(id) { 
  return request({
    url: '/caigou/buyBackOrder/'+id,
    method: 'get'
  })
}

export function stockOutDetail(orderId) {
  return request({
    url: '/store/stockOutDetail/'+orderId,
    method: 'get',
  })
}
// 新增出库记录
export function addStockOut(id) {
  return request({
    url: '/store/stockOut/add/'+id,
    method: 'get',
  })
}

export function addStockOutByTran(id) {
  return request({
    url: '/store/stockOut/addStockOutByTran/'+id,
    method: 'get',
  })
}
//获取所有仓库
export function getAllHouseList() {
  return request({
    url: '/store/warehouseInfo/list/all',
    method: 'get',
  })
}

// 修改出库记录
export function updateStockOut(data) {
  return request({
    url: '/store/stockOut',
    method: 'put',
    data: data
  })
}
export function addStockOutByBuyBack(buyBackOrder) {
  return request({
    url: '/store/stockOut/addStockOutByBuyBack',
    method: 'post',
    data: buyBackOrder
  })
}

export function outStock(stockOutSto) {
  return request({
    url: '/store/stockOut/outStock',
    method: 'post',
    data: stockOutSto
  })
}
// 删除出库记录
export function delStockOut(id) {
  return request({
    url: '/store/stockOut/' + id,
    method: 'delete'
  })
}
